package com.itfreer.power.dao.organize;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

import org.springframework.beans.BeanUtils;

import com.itfreer.form.api.JdbcBaseEntity;
import com.itfreer.power.dao.base.JdbcTreeEntityBase;
import com.itfreer.power.entity.organize.OrganizationEntity;

/**
 * jdbc组织机构
 */
@Entity(name = "sso_organize_organization")
@Table(indexes = { 
        @Index(name="sso_organization_code", columnList="s_code"),
        @Index(name="sso_organization_pid", columnList="pid") })
public class JdbcOrganizationEntity extends JdbcTreeEntityBase implements JdbcBaseEntity<OrganizationEntity> {

	private static final long serialVersionUID = -716935120587033763L;

	/**
	 * 所在省
	 */
	@Column(name = "s_sheng", length = 50, nullable = true)
	private String sheng;
	
	/**
	 * 所在市
	 */
	@Column(name = "s_shi", length = 50, nullable = true)
	private String shi;
	
	/**
	 * 所在县
	 */
	@Column(name = "s_xian", length = 50, nullable = true)
	private String xian;
	
	/**
	 * 具体地址
	 */
	@Column(name = "s_local", length = 254, nullable = true)
	private String local;
	
	/**
	 * 联系电话
	 */
	@Column(name = "s_tel", length = 50, nullable = true)
	private String tel;
	
	/**
	 * 其它属性json字符串
	 */
	@Column(name = "s_otherattributes", length = 2000, nullable = true)
	private String otherAttributesJson;

	/**
	 * 所在省
	 */
	public String getSheng() {
		return sheng;
	}

	/**
	 * 所在省
	 */
	public void setSheng(String sheng) {
		this.sheng = sheng;
	}

	/**
	 * 所在市
	 */
	public String getShi() {
		return shi;
	}

	/**
	 * 所在市
	 */
	public void setShi(String shi) {
		this.shi = shi;
	}

	/**
	 * 所在县
	 */
	public String getXian() {
		return xian;
	}

	/**
	 * 所在县
	 */
	public void setXian(String xian) {
		this.xian = xian;
	}

	/**
	 * 具体地址
	 */
	public String getLocal() {
		return local;
	}

	/**
	 * 具体地址
	 */
	public void setLocal(String local) {
		this.local = local;
	}

	/**
	 * 联系电话
	 */
	public String getTel() {
		return tel;
	}

	/**
	 * 联系电话
	 */
	public void setTel(String tel) {
		this.tel = tel;
	}

	/**
	 * 其它属性json字符串
	 */
	public String getOtherAttributesJson() {
		return otherAttributesJson;
	}

	/**
	 * 其它属性json字符串
	 */
	public void setOtherAttributesJson(String otherAttributesJson) {
		this.otherAttributesJson = otherAttributesJson;
	}
	
	@Override
	public void from(OrganizationEntity t) {
		BeanUtils.copyProperties(t, this);
	}

	@Override
	public OrganizationEntity toEntity() {
		OrganizationEntity toEntity = new OrganizationEntity();
		BeanUtils.copyProperties(this, toEntity);
		return toEntity;
	}
}
